using CLELCore.Assembly.BlobStreams;

namespace CLELCore.Assembly.Descriptors.ClassDescriptors
{
	public class SZArrayClassDescriptor : ClassDescriptor
	{
		private ClassDescriptor _sz_type;
		public ClassDescriptor SZType
		{
			get
			{
				return _sz_type;
			}
			set
			{
				_sz_type = value;
			}
		}
 
		public SZArrayClassDescriptor(ClassDescriptor sz_type) : base(ClassDescriptor.SZARRAY_CLASSDESCRIPTOR)
		{
			_sz_type = sz_type;
		}

		public override ClassDescriptor Copy()
		{
			return (ClassDescriptor)new SZArrayClassDescriptor(_sz_type);
		}

		public override byte [] ToBytes()
		{
			byte [] t = _sz_type.ToBytes();
			byte [] ret = new byte[t.Length+1];
			ret[0] = BlobElementType.ELEMENT_TYPE_SZARRAY;
			int i;
			for(i = 0;i < t.Length;i++)
				ret[i+1] = t[i];
			return ret;
		}
	}
}
